<template>
  <div class="home-page">
    <div class="home-logo"></div>
    <div class="page-btn">
      <div class="btn clear-both">
        <button class="query-btn"
                @click="typesearchClick('0')">包款查询</button>
        <button class="assess-btn"
                @click="typesearchClick('1')">精准估价</button>
      </div>
      <div class="bill-btn">
        <i class="iconfont icon-zhangben"></i>
        <span @click="toMycheck">我的账本</span>
      </div>
    </div>
    <div class="quit-btn"
         @click="quitBtn">
      <i class="iconfont icon-tuichu"></i>
      <span>退出登录</span>
    </div>
    <Err-Hint v-if="hint"
              :errInfo="errInfo"></Err-Hint>
  </div>
</template>

<script>
import ErrHint from '@/commonCom/errHint'
export default {
  name: 'Home',
  components: {
    ErrHint
  },
  data () {
    return {
      num: 0,
      hint: false,
      errInfo: {}
    }
  },
  methods: {
    setCookie (cname, cvalue, exdays) {
      var d = new Date()
      d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000))
      var expires = 'expires=' + d.toGMTString()
      document.cookie = cname + '=' + cvalue + '; ' + expires
    },
    quitBtn () {
      let url = `${this.baseUrl.logout}`
      // debugger
      // window.location.href = url

      this.$http.get(url).then((res) => {
        this.$store.commit('editUserName', '')
        this.$router.push('/')
      })
      // this.setCookie('JSESSIONID', '', -1)
      // window.localStorage.setItem('cookies', '')
      // document.cookie = ''
      // this.$router.push('http://61.147.124.83/youshehui/user/logout')
      // this.$http.get(url).then((res) => {
      //   debugger
      //   // this.$router.push('/')
      // })
    },
    toMycheck () {
      // this.errInfo = {
      //   text: '暂未开发'
      // }
      // setTimeout(() => {
      //   this.hint = false
      // }, 1000)
      // this.hint = true
      // this.$router.push({
      //   path: '/BrandChoseFilter'
      // })
      this.$store.commit('setBrandId', '')
      this.$router.push({ name: 'mycheck' })
    },
    typesearchClick (num) {
      this.$store.commit('typeidChangeClick', num)
      this.$router.push({
        path: '/brandChose',
        query: { id: num }
      })
    }
  }
}
</script>

<style lang="stylus" scoped>
.home-page
  .home-logo
    width 2.74rem
    height 2.74rem
    margin 1.48rem auto 1.5rem
    background-image url('../../static/images/login/login.png')
    background-size 100% 100%
  .page-btn
    padding 0 0.72rem
    .btn
      padding-bottom 0.8rem
    button
      height 0.9rem
      width 2.7rem
      line-height 0.86rem
      text-align center
      border 0.02rem solid $color
      border-radius 0.04rem
      font-size 0.32rem
      background-color #fff
      color $color
    .assess-btn
      float right
    .bill-btn
      position relative
      width 2rem
      margin 0 auto
      color $color
      i
        font-size 0.64rem
      span
        position absolute
        top 0.25rem
        font-size 0.32rem
  .quit-btn
    position absolute
    bottom 0.5rem
    left 50%
    width 3rem
    padding 0.2rem 0.3rem
    margin 0 -1.5rem
    font-size 0.32rem
    text-align center
    color $color
    i
      font-size 0.38rem
      vertical-align -0.02rem
</style>
